package com.zf.demo;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class GetBeanExample2 {
    public static void main(String[] args) {
        //1.得到容器对象
        ApplicationContext context = new ClassPathXmlApplicationContext("spring-config.xml");
        //2.获取bean对象
        UserService userService = context.getBean("user",UserService.class);
        //3.使用bean对象
        userService.func();
    }
}
